<?php
/*
 *   This file is part of Verbum.
 *
 *   poat is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   poat is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with poat.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *   Copyright (c) 2008 Sergio Gabriel Teves <gabriel.sgt at gmail.com>
 */ 

$isok = false;

if (isset($param['rc'])) {
	$temp = new temporal;
	$temp->id=$param['rc'];
	$r = $loader->get($temp);
	if ($r && $temp->options==CODE_USER_REG) {
		$team = new team;
		$team->id=$temp->teamid;
		$loader->get($team);
		
		echo "<script language=\"javascript\">tempId = '".$temp->id."';useMail='".$temp->extra."';useTeam='".$team->name."';teamId='".$team->id."';</script>";
		
		$isok=true;				
	}
}

if ($isok) {
	
	util::loadScript("user_reg");	
} else {
	$_log->warn("Invalid registration code ['".$param['rc']."']");
?>
<script language="javascript">

Verbum.Registration = function() {
	
    var regForm = new Ext.form.FormPanel({
        baseCls: 'x-plain',
        items: [{
		    xtype : 'label',
    		text : '<?php echo s("Sorry, your code is invalid or has expired.") ?>',
        }],
    });

    var regWindow = new Ext.Window({
        title: APPLICATION_NAME + '<?php echo "  [$TRANSID]" ?>' ,
        width: 350,
        height:100,
        layout: 'fit',
        bodyStyle:'padding:10px;',
        items: regForm,
		resizable: false,
		closable: false,
		draggable: false,
    });

    regWindow.show();
    
};

Ext.onReady(Verbum.Registration());

</script>
<?php } ?>

 